import { downloadAttament } from '@/api/workorder/common/attachment';
import type { FormSchema } from '@/components/core/schema-form/';
import { InboxOutlined } from '@ant-design/icons-vue';
import { reactive } from 'vue';

// 当前页面使用的数据
export let uploadFileObject = reactive({
  uploadFileList: [],
  defaultFileList: []
});

// 督办申请单表单数据
export const disregardschemas: FormSchema[] = [
 
  {
    field: 'id',
    component: 'Input',
    colProps: {
      span: 0,
    },
    componentProps: {
      hidden: true,
    },
  },
  {
    field: 'content',
    component: 'InputTextArea',
    label: '* 不计考核依据',
    componentProps: {
      rows: 3,
    },
    rules: [
      { required: true, type: 'string',message: '请输入不计考核依据' },
      { max: 10000, message: '督办内容不能大于5000个字' },
    ],
    colProps: {
      span: 24,
    },
  },
  
  {
    field: 'attamentBj',
    component: 'UploadDragger',
    label: '附件',
    colProps: {
      span: 24,
    },
    vShow: false,
    componentProps: {
      beforeUpload: (() => {
        return false;
      }),
      onChange: ((fileList: any) => {
        uploadFileObject.uploadFileList = fileList.fileList
      }),
      showUploadList: {
        showDownloadIcon: true
      },
      onDownload: ((file) => {
        // 文件下载
        downloadAttament(file.uid)
      })
    },
    componentSlots: {
      default: () => (
        <div>
          <p><InboxOutlined /></p>
          <p style={'color:blue'}>将文件拖到此处或点击上传</p>
        </div>
      ),
    },
  },
];

